<template>
    <view class="content">
        
		<!-- 底部导航 -->
		<u-tabbar v-model="current" :list="tab_list" inactive-color="#5d5f6a" active-color="#00b6bc" 
			:border-top="false" zIndex="999" @change="tabbarChange"></u-tabbar>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                current: 0, //底部导航索引
                tab_list: [{
                		iconPath: "/static/icon/tab_2.png",
                		selectedIconPath: "/static/icon/tab_1.png",
                		text: '健康管理',
                		customIcon: false,
                		pagePath: "/pages/tabbar/index"
                	},
                	{
                		iconPath: "/static/icon/tab_4.png",
                		selectedIconPath: "/static/icon/tab_3.png",
                		text: '客服',
                		customIcon: false,
                		pagePath: "/pages/tabbar/kefu"
                	},
                	{
                		iconPath: "/static/icon/tab_6.png",
                		selectedIconPath: "/static/icon/tab_5.png",
                		text: '个人中心',
                		customIcon: false,
                		pagePath: "/pages/tabbar/mine"
                	},
                ],
            };
        },
        onLoad() {
            
        },
		onShow() {
			if (!this.$getSync('userToken')) {
				uni.showModal({
				    title: '温馨提示',
				    content: '请先登录',
				    success: (res) => {
				        if (res.confirm) {
				            this.$gTo(`/pages/login/loginH`)
				        } else if (res.cancel) {
							this.$sTo(`/pages/tabbar/index`)
						}
				    }
				})
			} else {
				uni.showModal({
				    title: '温馨提示',
				    content: '是否联系客服？',
				    success: (res) => {
				        if (res.confirm) {
							window.location.href = 'https://work.weixin.qq.com/kfid/kfc7b92dee1aa6e7fe5';
				            // this.$gTo(`/pages/pay/web`)
				        } else if (res.cancel) {
							this.$sTo(`/pages/tabbar/index`)
						}
				    }
				})
			}
		},
        methods: {
            //切换底部导航
            tabbarChange(e) {
            	this.current = e;
            },
        }
    };
</script>

<style lang="scss">
    page{
        background-color: #f5f5f5;
    }

</style>
